home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.io.DataInputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.net.MalformedURLException;
- import java.net.URL;
-
- public class realdata extends Applet {
- private String m_URL = "";
- private final String PARAM_URL = "URL";
- DataInputStream input;
- URL resource;
- String inputLine;
- String Total;
- InputStream res;
-
- public void start() {
- }
-
- public String[][] getParameterInfo() {
- String[][] info = new String[][]{{"URL", "String", "URL of file to be read"}};
- return info;
- }
-
- public void stop() {
- }
-
- public int NewURL(String s) {
- this.m_URL = s;
- return 1;
- }
-
- public String About() {
- return "AppletName: RealData\r\n" + "Author: Hans Hugli\r\n" + "Version: 1.0 build 1";
- }
-
- public String OpenFile() {
- try {
- this.resource = new URL(((Applet)this).getDocumentBase(), this.m_URL);
- } catch (MalformedURLException var6) {
- return ((Throwable)var6).getMessage();
- }
-
- try {
- this.res = this.resource.openStream();
- } catch (IOException var3) {
- return "openStream " + ((Throwable)var3).getMessage();
- } catch (SecurityException var4) {
- return "openStream " + ((Throwable)var4).getMessage();
- } catch (Exception var5) {
- return "openStream " + ((Throwable)var5).getMessage();
- }
-
- try {
- this.input = new DataInputStream(this.res);
-
- for(this.Total = this.input.readLine(); (this.inputLine = this.input.readLine()) != null; this.Total = this.Total + "\n" + this.inputLine) {
- }
- } catch (MalformedURLException var7) {
- return "Malformed URL Exception";
- } catch (IOException var8) {
- return ((Throwable)var8).getMessage();
- } catch (Exception var9) {
- return ((Throwable)var9).getMessage();
- }
-
- return this.Total + "\n" + "Done";
- }
-
- public void destroy() {
- }
-
- public void init() {
- String param = ((Applet)this).getParameter("URL");
- if (param != null) {
- this.m_URL = param;
- }
-
- ((Applet)this).resize(1, 1);
- }
- }
-